import React from 'react';
import BreadcrumbCustom from '../../BreadcrumbCustom';
import {Row, Tabs} from 'antd';
import * as Request from '../../../Server/Upgrade';
import * as config from '../../../axios/config';
import LimitMACTable from "./LimitMACTable";
require('./commonInfo.css');
const TabPane = Tabs.TabPane;

class LimitMAC extends React.Component{
    constructor(props){
        super(props);
        this.state = {
            activeKey : '1'
        };
    }

    changeTab = (activeKey) => {
        this.setState({activeKey});
    }

    render(){
        return (
            <div>
                <Row>
                    <BreadcrumbCustom first={'限制MAC表'}/>
                </Row>
                <Row style={{paddingTop:5}}>
                    <Tabs activeKey={this.state.activeKey} type={'card'} onChange={this.changeTab}>
                        <TabPane tab={'允许MAC表'} key={'1'}>
                            <LimitMACTable
                                page={Request.allowMACsPage}
                                save={Request.allowMACSave}
                                update={Request.allowMACUpdate}
                                find = {Request.allowMACGetById}
                                delete = {Request.allowMACDeleteById}
                                validator = {Request.allowMACValidator}
                                importUrl = {config.ALLOW_MAC_IMPORT}
                                export = {Request.allowMACExport}
                                title = {'允许MAC'}
                            />
                        </TabPane>
                        <TabPane tab={'拒绝MAC表'} key={'2'}>
                            <LimitMACTable
                                page={Request.denyMACsPage}
                                save={Request.denyMACSave}
                                update={Request.denyMACUpdate}
                                find = {Request.denyMACGetById}
                                delete = {Request.denyMACDeleteById}
                                validator = {Request.denyMACValidator}
                                importUrl = {config.DENY_MAC_IMPORT}
                                export = {Request.denyMACExport}
                                title = {'拒绝MAC'}
                            />
                        </TabPane>
                    </Tabs>
                </Row>
            </div>
        );
    }
}

export default LimitMAC;